{* $Id$ *}
{include_core file="admin/lib/header.html" title="快速充值"}
<div class="page-header border-bottom clearfix">
    <h2 class="left">快速充值<span>为用户增加余额</span></h2>
    <a href="{AnUrl('user/admin/index')}" class="btn btn-default btn-sm right">跳转到用户列表</a>
    <a href="{AnUrl('user_money/admin/user_money/index')}" class="btn btn-default btn-sm right">跳转到余额记录列表</a>
</div>
<!--start:余额记录新增-->
<div class="add-form">
    <form action="{AnUrl('user_money/admin/user_money/change')}" method="post" enctype="multipart/form-data">
        <input type="hidden" name="user_money[res_id]" value="{user_money_config::RES_TYPE_DEALER_RECHARGE}">
        <table class="table" cellpadding="0" cellspacing="0">
            <tr>
                <td style="text-align: right">
                    <label class="add-f-label">用户：</label>
                </td>
                <td>
                    {if !isset($AGENCY_LIST)}
                    {$AGENCY_LIST = user_helper::get_all_dealers_info()}
                    {/if}
                    <select placeholder="请选择合伙人" class="add-f-ipt1" id="suggest_agency" name="user_money[user_id]">
                        <option value="0" selected="selected">请选择合伙人</option>
                        {foreach $AGENCY_LIST as $k => $v}
                        <option value="{$v.id}">{$v.realname}({$v.mobile})</option>
                        {/foreach}
                    </select>
                </td>
            </tr>
            <tr>
                <td style="text-align: right" valign="top">
                    <label class="add-f-label">类型：</label>
                </td>
                <td>
                    <select name="user_money[res_id]">
                        {foreach $RES_TYPE as $k => $v}
                        <option value="{$v.id}">{$v.res_name}</option>
                        {/foreach}
                    </select>
                </td>
            </tr>
            <tr>
                <td style="text-align: right" valign="top">
                    <label class="add-f-label">金额：</label>
                </td>
                <td>
                    <input name="user_money[user_money]" style="width:450px;" type="number"
                           class="add-f-ipt1 js_user_money"
                           maxlength="50" placeholder="请输入金额" step="0.01">
                </td>
            </tr>
            <tr>
                <td style="text-align: right" valign="top">
                    <label class="add-f-label">备注：</label>
                </td>
                <td>
                    <textarea class="add-f-ipt1" name="user_money[extra]" style="width:450px;height:100px;"></textarea>
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td>
                    <button type="submit" class="btn btn-success">&nbsp;&nbsp;&nbsp;添加&nbsp;&nbsp;&nbsp;</button>
                </td>
            </tr>
        </table>
    </form>
</div>
<!--end:余额记录新增-->
<script>

    $(function () {
        //控制ajax的同步还是异步

        // 提交验证
        $('form').submit(function () {
            //验证
            if ($('input[name="user_money[user_id]"]').val() == '') {
                showMsg('请选择合伙人');
                return false;
            }

            if ($('input[name="user_money[user_money]"]').val() == '') {
                showMsg('余额数不能为空!');
                return false;
            }
        });

    });

</script>
{include_core file="module/suggestion.html" id="suggest_agency"}
{include_core file="admin/lib/footer.html"}